package com.maker.ai.controller;

import com.maker.ai.aiservice.ChatService;
import dev.langchain4j.model.openai.OpenAiChatModel;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class ChatController {
    @Resource
    private OpenAiChatModel model;
    @Resource
    private ChatService chatService;


    @RequestMapping(value = "/chat", produces="text/html;charset=utf-8")
    public Flux<String> chat(String memoryId,String message){
        Flux<String> result = chatService.chat(memoryId,message);
        return result;
    }


//    @RequestMapping("/chat")
//    public String chat(String message){
//        String result = chatService.chat(message);
//        return result;
//    }



//    @RequestMapping("/chat")
//    public String chat(String message){
//        String result = model.chat(message);
//        return result;
//    }
}
